import { businessStateMap } from "./store";
import { handleSearchLoading } from "@userList/search";
const searchLoading = ref(false);
const resetLoading = ref(false);
export const searchConfig = ({
  handleAction,
  refreshTable = (arg: any) => {},
}: any) => {
  const defineSearch = {
    okText: getProxyT("base.query"),
    cancelText: getProxyT("base.reset"),
    searchLoading,
    resetLoading,
    refreshTableData: async (searchParams: any, type: any) => {
      searchParams.status =
        searchParams.status === "" ? undefined : searchParams.status;
      handleSearchLoading(true, type, defineSearch);
      await refreshTable(searchParams);
      handleSearchLoading(false, type, defineSearch);
    },
    searchList: [
      {
        label: getProxyT("club8"),
        type: "input",
        model: "im_groupid",
        allowClear: true,
        placeholder: "请输入俱乐部ID",
      },
      {
        label: getProxyT("club9"),
        type: "input",
        model: "name",
        allowClear: true,
        placeholder: "请输入俱乐部名称",
      },
      {
        label: getProxyT("club22"),
        type: "select",
        model: "status",
        placeholder: "请选择状态",
        searchClass: "search-item-width-150",
        allowClear: true,
        options: businessStateMap,
      },
      {
        label: getProxyT("club13"),
        type: "input",
        model: "author",
        allowClear: true,
        placeholder: "请输入群主名称/世界ID",
      },
      {
        label: getProxyT("club23"),
        type: "rangePicker",
        model: "start_end",
        placeholder: computed(() => [$t("base.startTime"), $t("base.endTime")]),
      },
    ],
  };
  return defineSearch;
};
